Welcome to my blog!

Retrieve lost code from Jupyter notebook

I’ve just spent some significant amount of time working on notebook and restarted computer without saving or committing notebook.

As soon as I have realized what happened I was devastated. Couple of hours of work were gone for good. 🙁

Luckily , it is possible to retrieve history of the commands from the notebook itself. Just run next command and it will dump all it has to a text file :

%history -g -f my_notebook_code.txt

Leave a Reply

Your email address will not be published. Required fields are marked *